//
//  HomeAlertVC.swift
//  KJLGT
//
//  Created by jenkin on 2019/9/10.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import UIKit

class HomeAlertVC: LGTBaseVC {

    var info:Dictionary<String, Any>?
    var imageView:UIImageView?
    var clickInfoBlock:ClickInfoBlock?
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func setUI() {
        super.setUI()
        self.view.backgroundColor = BlackAlpha46
        self.imageView = LGTViewCreateUtil.share.createImageViewCorner(corner: 0.1)
        self.imageView?.isUserInteractionEnabled = true
        self.view.addSubview(self.imageView!)
        self.imageView!.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            make.width.equalTo(SizeFit(332))
            make.height.equalTo(SizeFit(417))
        }
        
        self.view.isUserInteractionEnabled = true
        let tap2:UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(gotoAction))
        self.view!.addGestureRecognizer(tap2)
        
        
        let tap:UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(gotoAction))
        tap.cancelsTouchesInView = false
        self.imageView!.addGestureRecognizer(tap)
        
        
        let url:String = self.info?["img"] as? String ?? ""
        BaseUtil.baseUtil.setImage(imageView: self.imageView!, imageUrl: url, type:.BigImageType)
    }
    
    @objc func gotoAction(tap:UITapGestureRecognizer){
        self.dismiss(animated: false, completion: nil)
        if tap.view == self.view{
            return
        }
        
        if self.clickInfoBlock != nil{
            self.clickInfoBlock!(1, self.info ?? [:])
        }
    }
}
